import request from '/@/utils/request';

import { createDDE_SA } from '/@/utils/stringUtil';

const DDE_SA = createDDE_SA(BASE_API.ENT_CODE || 0, 0, 0);
const headers = { 'DDE-SA': DDE_SA, 'Content-Type': 'application/json;charset=UTF-8' };
export function getProjects(params) {
	return request({
		url: '/user/getProjects.action',
		method: 'post',
		params: params,
	});
}

export function getUserProjects(params) {
	return request({
		url: '/eslithe/QueryProjectList.action',
		method: 'post',
		params: params,
	});
}
export function addProjects(params) {
	return request({
		url: '/eslithe/addProjects.action',
		method: 'post',
		params: params,
	});
}

export function addUserBelong(params) {
	return request({
		url: '/eslithe/addUserBelong.action',
		method: 'post',
		params: params,
	});
}

export function deleteUserBelong(params) {
	return request({
		url: '/eslithe/deleteUserBelong.action',
		method: 'post',
		params: params,
	});
}
export function updateProjects(params) {
	return request({
		url: '/user/updateProject.action',
		method: 'post',
		params: params,
	});
}

export function releaseProjects(params) {
	return request({
		url: '/user/releaseProject.action',
		method: 'post',
		params: params,
	});
}

// 查询项目（服务商城）
export function queryProjects(params) {
	return request({
		url: '/user/queryProjects.action',
		method: 'post',
		params: params,
	});
}

// 查询项目信息
export function getProjectInfo(params) {
	return request({
		url: '/user/getProjectInfo.action',
		method: 'post',
		params: params,
	});
}

// 查询项目信息 (切换项目)
export function switchProject(queryForm) {
	return request({
		url: '/eslithe/switchProject.action',
		method: 'post',
		params: queryForm,
	});
}

export function deleteFile(params) {
	return request({
		url: '/user/deleteFile.action',
		method: 'post',
		params: params,
	});
}

export function download(params) {
	// 需要登录
	return request({
		url: '/eslithe/download.action',
		method: 'post',
		params: params,
		// responseType: 'arraybuffer'
	});
}

export function downloadNoLogin(params) {
	// 不需要登录
	return request({
		url: '/eslithe/file.action',
		method: 'post',
		params: params,
		// responseType: 'arraybuffer'
	});
}

export function saveFileContent(params, data) {
	// 不需要登录
	return request({
		url: '/eslithe/saveFileContent.action',
		method: 'post',
		headers: {
			'Content-Type': 'application/octet-stream', // 文件上传时的格式
		},
		params: params, // 请求头
		data: data, // body
	});
}

export function queryPubServicesInfo(params) {
	// 不需要登录
	return request({
		url: '/service/queryPubServicesInfo.action',
		method: 'post',
		params: params,
	});
}

export function releasePubServiceInfo(params) {
	// 需要登录
	return request({
		url: '/service/releasePubServiceInfo.action',
		method: 'post',
		params: params,
	});
}

export function updatePubServiceInfo(params) {
	// 需要登录
	return request({
		url: '/service/updatePubServiceInfo.action',
		method: 'post',
		params: params,
	});
}

export function queryPubServiceMethod(params) {
	// 不需要登录
	return request({
		url: '/service/queryPubServiceMethod.action',
		method: 'post',
		params: params,
	});
}

export function releasePubServiceMethod(params) {
	// 需要登录
	return request({
		url: '/service/releasePubServiceMethod.action',
		method: 'post',
		params: params,
	});
}

export function updatePubServiceMethod(params) {
	// 需要登录
	return request({
		url: '/service/updatePubServiceMethod.action',
		method: 'post',
		params: params,
	});
}

export function deletePubServiceMethod(params) {
	// 需要登录
	return request({
		url: '/service/deletePubServiceMethod.action',
		method: 'post',
		params: params,
	});
}

export function queryPubMethodParam(params) {
	// 不需要登录
	return request({
		url: '/service/queryPubMethodParam.action',
		method: 'post',
		params: params,
	});
}

export function addPubMethodParam(params) {
	// 需要登录
	return request({
		url: '/service/addPubMethodParam.action',
		method: 'post',
		params: params,
	});
}

export function updatePubMethodParam(params) {
	// 需要登录
	return request({
		url: '/service/updatePubMethodParam.action',
		method: 'post',
		params: params,
	});
}

export function deletePubMethodParam(params) {
	// 需要登录
	return request({
		url: '/service/deletePubMethodParam.action',
		method: 'post',
		params: params,
	});
}

export function queryMaxProjectID(params) {
	// 需要登录
	return request({
		url: '/project/queryMaxProjectID.action',
		method: 'post',
		params: params,
	});
}

export function addProjectConfig(params) {
	// 需要登录
	return request({
		url: '/eslithe/addProjectConfig.action',
		method: 'post',
		params: params,
	});
}

export function deleteProjects(params) {
	// 删除项目
	return request({
		url: '/user/deleteProjects.action',
		method: 'post',
		params: params,
	});
}

export function updateProjectsinfo(params) {
	return request({
		url: '/user/updateProjectsinfo.action',
		method: 'post',
		params: params,
	});
}

// 查询项目信息(新)
export function queryProjectInfo(params) {
	return request({
		url: '/eslithe/queryProjectInfo.action',
		method: 'post',
		params: params,
	});
}

export function uploadFile(param) {
	return request({
		url: '/eslithe/uploadFile.action',
		method: 'post',
		// headers: { 'Content-Type': 'multipart/form-data' },
		data: param,
	});
}

export function addToProjectDomain(params) {
	return request({
		url: '/eslithe/addToProjectDomain.action',
		method: 'post',
		params: params,
	});
}

export function queryEnterpriseDomain(params) {
	return request({
		url: '/eslithe/queryEnterpriseDomain.action',
		method: 'post',
		params: params,
	});
}

export function queryHelpTips(params) {
	return request({
		url: '/eslithe/queryHelpTips.action',
		method: 'post',
		params: params,
	});
}
// 枚举
export function queryEnumOptions(params) {
	return request({
		url: '/eslithe/queryEnumOptionsNew.action',
		headers,
		method: 'post',
		params: params,
	});
}

export function addEnumOptions(params) {
	return request({
		url: '/eslithe/add_dev_enum_options.action',
		headers,
		method: 'post',
		params: params,
	});
}

export function updateEnumOptions(params) {
	return request({
		url: '/eslithe/update_dev_enum_options.action',
		headers,
		method: 'post',
		params: params,
	});
}

export function delEnumOptions(params) {
	return request({
		url: '/eslithe/delete_dev_enum_options.action',
		headers,
		method: 'post',
		params: params,
	});
}
